package com.unicomcz.autojobs.sms;

import java.sql.CallableStatement;
import java.sql.PreparedStatement;

import org.apache.log4j.Category;
import org.hibernate.Session;

public class SendSMS {
	
	public boolean Submit(Category log,Session session,String deviceNumber,String msg){
		CallableStatement cstmt = null;
		
		int rtv = -1;
		try{
			cstmt = session.connection().prepareCall("{ call sms.Send8980(?,?,?)}");
			cstmt.setString(1, deviceNumber);
			cstmt.setString(2, msg);
			cstmt.registerOutParameter(3, java.sql.Types.INTEGER);
			cstmt.execute();
			rtv = cstmt.getInt(3);
		}catch(Exception e){
		   log.error(e);
		}
		try{
			cstmt.close();
		}catch(Exception e){
			
		}
		if (rtv != 0) {
			return false;
		}
		return true;
	}

}
